home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / infosrvr / dev / scott / WWW / NextStep / Implementation / old / HTParse.h < prev    next >
C/C++ Source or Header  |  1991-06-27  |  2KB  |  88 lines

  1. /*        Parse HyperText Document Address        HTParse.h
  2. **        ================================
  3. */
  4. /*    These are flag bits which may be ORed together to form a number to give
  5. **    the 'wanted' argument to HTParse.
  6. */
  7. #define PARSE_ACCESS        16
  8. #define PARSE_HOST         8
  9. #define PARSE_PATH         4
  10. #define PARSE_ANCHOR         2
  11. #define PARSE_PUNCTUATION     1
  12. #define PARSE_ALL        31
  13.  
  14. /*    Parse a Name relative to another name
  15. **    -------------------------------------
  16. **
  17. **    This returns those parts of a name which are given (and requested)
  18. **    substituting bits from the realted name where necessary.
  19. **
  20. ** On entry,
  21. **    aName        A filename given
  22. **    relatedName    A name relative to ehich aName is to be parsed
  23. **      wanted          A mask for the bits which are wanted.
  24. **
  25. ** On exit,
  26. **    returns        A pointer to a malloc'd string which MUST BE FREED
  27. */
  28. #ifdef __STDC__
  29. extern char * HTParse(const char * aName, const char * relatedName, int wanted);
  30. #else
  31. extern char * HTParse();
  32. #endif
  33.  
  34. /*    Strip white space off a string
  35. **    ------------------------------
  36. **
  37. ** On exit,
  38. **    Return value points to first non-white character, or to 0 if none.
  39. **    All trailing white space is OVERWRITTEN with zero.
  40. */
  41. #ifdef __STDC__
  42. extern char * HTStrip(char * s);
  43. #else
  44. extern char * HTStrip();
  45. #endif
  46.  
  47. /*            Simplify a filename
  48. **        -------------------
  49. **
  50. **    A unix-style file is allowed to contain the seqeunce xxx/../ which
  51. **    may be replaced by "" , and the seqeunce "/./" which may be replaced
  52. **    by "/".
  53. **    Simplification helps us recognize duplicate filenames. It doesn't deal
  54. **    with soft links, though.
  55. **    The new (shorter) filename overwrites the old.
  56. **
  57. **    Thus,     /etc/junk/../fred     becomes    /etc/fred
  58. **        /etc/junk/./fred    becomes    /etc/junk/fred
  59. */
  60. #ifdef __STDC__
  61. extern void HTSimplify(char * filename);
  62. #else
  63. extern void HTSimplify();
  64. #endif
  65.  
  66. /*        Make Relative Name
  67. **        ------------------
  68. **
  69. **    This function creates and returns a string which gives an expression of
  70. **    one address as related to another. Where there is no relation, an
  71. **    absolute address is retured.
  72. **
  73. **  On entry,
  74. **    Both names must be absolute, fully qualified names of nodes
  75. **    (no anchor bits)
  76. **
  77. **  On exit,
  78. **    The return result points to a newly allocated name which, if parsed
  79. **    by HTParse relative to relatedName, will yield aName. The caller is
  80. **    responsible for freeing the resulting name later.
  81. **
  82. */
  83. #ifdef __STDC__
  84. extern char * HTRelative(const char * aName, const char *relatedName);
  85. #else
  86. extern char * HTRelative();
  87. #endif
  88.